﻿<?php
/**
 * Pagecurl is a yii widget for the The Sexy Curls JQuery Plugin...
 * Originally By Elliott Kember - http://twitter.com/elliottkember
 * Released under the MIT license (MIT-LICENSE.txt)
 * Ported to yii by Jason Clark aka mithereal.
 *
 * TODO:: Alow user to specify js options via widget instantation
 * any one wanna tackle this?
 */

class Pagecurl extends CWidget
{
    protected $assets;
    public $bgimage='code.png';
    public $cssfile='pagecurl.css';
    
    /*
     *
    public $target='target';  //the target id of the div we will be manuipilating with js 
    public $side= 'left';           // change me to "right" if you want rightness
    public $maxHeight= 400;         // The maximum height. Duh.
    public $starting_width= 80;     // The height and width 
    public $starting_height= 80;    // width which to start 
    public $autoCurl=false ;        // If this is set to true, the fold will curl/uncurl on mouseover/mouseout.
  
    // Set up the wrapper objects
    public $turn_hideme_id = 'turn_hideme';
    public $turn_wrapper_id = 'turn_wrapper';
    public $turn_object_id = 'turn_object';
    public $img_id ='turn_fold';
    */
    
   

	/**
	 * Initializes the widget.
	 */
	public function init()
	{
	    if($this->assets===null)
        {
	
            $file=dirname(__FILE__).DIRECTORY_SEPARATOR.'assets';
            $this->assets=Yii::app()->getAssetManager()->publish($file);
            $this->registerClientScript();
        }
	
	}
	
    protected function registerClientScript()
    {
        $cs=Yii::app()->clientScript;
	$cs->registerCoreScript('jquery');
	$cs->registerScriptFile($this->assets.'/jqueryui.js');
	$cs->registerScriptFile($this->assets.'/pagecurl.js');
	$cs->registerCssFile($this->assets.'/'.$this->cssfile);
    }

	/**
	 * Executes the widget.
	 */
    public function run()
    {
       // echo '<img id="'.$this->target.'" src="'.$this->assets.  '/'.$this->bgimage.'">';
        echo '<img id="target" src="'.$this->assets.  '/'.$this->bgimage.'">';
    }
    
    protected function getJs(){
	
    }
}
